<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item>学生管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图区 -->
    <el-card class="box-card">
      <!-- 搜索与添加区域 -->
      <el-row :gutter="20" class="el-row-table">
        <el-col :span="12"
          ><div class="grid-content bg-purple">
            <el-input placeholder="请输入内容" clearable>
              <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input></div
        ></el-col>
        <!-- <el-col :span="4">
          <div class="grid-content bg-purple">
            <el-button type="primary">批量导出</el-button>
          </div>
        </el-col> -->

        <!-- <el-col :span="4">
          <div class="grid-content bg-purple">
            <el-button type="danger">批量删除</el-button>
          </div>
        </el-col> -->

        <el-col :span="4">
          <div class="grid-content bg-purple">
            <el-button type="success">刷新</el-button>
          </div>
        </el-col>
      </el-row>

      <!-- 课程列表区域 -->
      <el-table border stripe width="100%" :data="User">
        <el-table-column fixed label="序号" prop="index"> </el-table-column>
        <el-table-column fixed label="用户名" width="100" prop="coursename">
        </el-table-column>
        <el-table-column fixed label="姓名" prop="username"> </el-table-column>
        <el-table-column fixed label="经验值" width="100" prop="expervalue">
        </el-table-column>
        <el-table-column fixed label="手机号" prop="phone"> </el-table-column>
        <el-table-column fixed label="邮箱" prop="email"> </el-table-column>
        <el-table-column fixed label="角色类型" width="180">
          <template>
            <!-- 第一个是查看详情按钮 -->
            <el-tooltip
              effect="dark"
              content="编辑"
              placement="top"
              :enterable="false"
            >
              <el-button type="success" icon="el-icon-check" circle></el-button>
            </el-tooltip>

            <!-- 第二个是修改按钮 -->
            <el-tooltip
              effect="dark"
              content="删除"
              placement="top"
              :enterable="false"
            >
              <el-button type="primary" icon="el-icon-edit" circle></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页区域 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryInfo.current"
        :page-sizes="[5, 10]"
        :page-size="queryInfo.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //获取用户列表的参数对象
      queryInfo: {
        current: 1,
        size: 5,
        name: "",
      },
      total: 0,

      User: [
        {
          index: 1,
          coursename: "数学",
          username: "zyy",
          expervalue: 20,
          phone: 13110773990,
          email: "2869458256@qq.com",
          roleId: "学生",
        },
        {
          index: 2,
          coursename: "语文",
          username: "hxg",
          expervalue: 20,
          phone: 17720818667,
          email: "283350193@qq.com",
          roleId: "学生",
        },
      ],
    };
  },
  created() {
    // this.getCourserList();
  },
  methods: {
    // 监听 pagesize 改变的事件
    handleSizeChange(newSize) {
      this.queryInfo.size = newSize;
      // this.getCourserList();
    },
    // 监听 页码值 改变的事件
    handleCurrentChange(newPage) {
      this.queryInfo.current = newPage;
      // this.getCourserList();
    },
  },
};
</script>

<style lang="less" scoped>
.breadcrumb {
  margin-bottom: 15px;
  font-size: 15px;
}
.box-card {
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
}
.el-row-table {
  margin-bottom: 15px !important;
}
.el-pagination {
  margin-top: 15px;
}
</style>